<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>ft_sql - Vim Documentation</title>
<meta name="Generator" content="Vim/8.0">
<meta name="plugin-version" content="vim8.0">
<meta name="syntax" content="help">
<meta name="settings" content="no_pre,use_css,expand_tabs">
<link rel="stylesheet" href="style.css" type="text/css" />

<script src="jquery.min.js" type="text/javascript"></script>
<script src="mark-current-page.js" type="text/javascript"></script>
</head>

<body>

<header>

<div class="header">
  <a href="http://vim-jp.org/">vim-jp</a>
  / <a href="http://vim-jp.org/vimdoc-en/">vimdoc-en</a>
  / ft_sql<br />
  <a name="top"></a><h1>ft_sql - Vim Documentation</h1>
  <a href="index.html">Return to main</a>

  <span class="EnglishJapaneseLink">
    <span class="CurrentLanguage">English</span>
  </span>
</div>
</header>

<nav>
<dl>

<dt>BASIC</dt>
<dd><ul>
<li><a href="quickref.html">quickref</a></li>
<li><a href="sponsor.html">sponsor</a></li>
</ul></dd>

<dt>USER MANUAL</dt>
<dd><ul>
<li><a href="usr_toc.html">usr_toc</a></li>
</ul></dd>

<dt>Getting Started</dt>
<dd><ul>
<li><a href="usr_01.html">usr_01</a></li>
<li><a href="usr_02.html">usr_02</a></li>
<li><a href="usr_03.html">usr_03</a></li>
<li><a href="usr_04.html">usr_04</a></li>
<li><a href="usr_05.html">usr_05</a></li>
<li><a href="usr_06.html">usr_06</a></li>
<li><a href="usr_07.html">usr_07</a></li>
<li><a href="usr_08.html">usr_08</a></li>
<li><a href="usr_09.html">usr_09</a></li>
<li><a href="usr_10.html">usr_10</a></li>
<li><a href="usr_11.html">usr_11</a></li>
<li><a href="usr_12.html">usr_12</a></li>
</ul></dd>

<dt>Editing Effectively</dt>
<dd><ul>
<li><a href="usr_20.html">usr_20</a></li>
<li><a href="usr_21.html">usr_21</a></li>
<li><a href="usr_22.html">usr_22</a></li>
<li><a href="usr_23.html">usr_23</a></li>
<li><a href="usr_24.html">usr_24</a></li>
<li><a href="usr_25.html">usr_25</a></li>
<li><a href="usr_26.html">usr_26</a></li>
<li><a href="usr_27.html">usr_27</a></li>
<li><a href="usr_28.html">usr_28</a></li>
<li><a href="usr_29.html">usr_29</a></li>
<li><a href="usr_30.html">usr_30</a></li>
<li><a href="usr_31.html">usr_31</a></li>
<li><a href="usr_32.html">usr_32</a></li>
</ul></dd>

<dt>Tuning Vim</dt>
<dd><ul>
<li><a href="usr_40.html">usr_40</a></li>
<li><a href="usr_41.html">usr_41</a></li>
<li><a href="usr_42.html">usr_42</a></li>
<li><a href="usr_43.html">usr_43</a></li>
<li><a href="usr_44.html">usr_44</a></li>
<li><a href="usr_45.html">usr_45</a></li>
</ul></dd>

<dt>Making Vim Run</dt>
<dd><ul>
<li><a href="usr_90.html">usr_90</a></li>
</ul></dd>

<dt>General subjects</dt>
<dd><ul>
<li><a href="intro.html">intro</a></li>
<li><a href="index.html">help</a></li>
<li><a href="helphelp.html">helphelp</a></li>
<li><a href="vimindex.html">index</a></li>
<li><a href="tags.html">tags</a></li>
<li><a href="howto.html">howto</a></li>
<li><a href="tips.html">tips</a></li>
<li><a href="message.html">message</a></li>
<li><a href="quotes.html">quotes</a></li>
<li><a href="todo.html">todo</a></li>
<li><a href="debug.html">debug</a></li>
<li><a href="develop.html">develop</a></li>
<li><a href="uganda.html">uganda</a></li>
</ul></dd>

<dt>Basic editing</dt>
<dd><ul>
<li><a href="starting.html">starting</a></li>
<li><a href="editing.html">editing</a></li>
<li><a href="motion.html">motion</a></li>
<li><a href="scroll.html">scroll</a></li>
<li><a href="insert.html">insert</a></li>
<li><a href="change.html">change</a></li>
<li><a href="indent.html">indent</a></li>
<li><a href="undo.html">undo</a></li>
<li><a href="repeat.html">repeat</a></li>
<li><a href="visual.html">visual</a></li>
<li><a href="various.html">various</a></li>
<li><a href="recover.html">recover</a></li>
</ul></dd>

<dt>Advanced editing</dt>
<dd><ul>
<li><a href="cmdline.html">cmdline</a></li>
<li><a href="options.html">options</a></li>
<li><a href="pattern.html">pattern</a></li>
<li><a href="map.html">map</a></li>
<li><a href="tagsrch.html">tagsrch</a></li>
<li><a href="quickfix.html">quickfix</a></li>
<li><a href="windows.html">windows</a></li>
<li><a href="tabpage.html">tabpage</a></li>
<li><a href="syntax.html">syntax</a></li>
<li><a href="spell.html">spell</a></li>
<li><a href="diff.html">diff</a></li>
<li><a href="autocmd.html">autocmd</a></li>
<li><a href="filetype.html">filetype</a></li>
<li><a href="eval.html">eval</a></li>
<li><a href="channel.html">channel</a></li>
<li><a href="fold.html">fold</a></li>
</ul></dd>

<dt>Special issues</dt>
<dd><ul>
<li><a href="print.html">print</a></li>
<li><a href="remote.html">remote</a></li>
<li><a href="term.html">term</a></li>
<li><a href="digraph.html">digraph</a></li>
<li><a href="mbyte.html">mbyte</a></li>
<li><a href="mlang.html">mlang</a></li>
<li><a href="arabic.html">arabic</a></li>
<li><a href="farsi.html">farsi</a></li>
<li><a href="hebrew.html">hebrew</a></li>
<li><a href="russian.html">russian</a></li>
<li><a href="ft_ada.html">ft_ada</a></li>
<li><a href="ft_sql.html">ft_sql</a></li>
<li><a href="hangulin.html">hangulin</a></li>
<li><a href="rileft.html">rileft</a></li>
</ul></dd>

<dt>GUI</dt>
<dd><ul>
<li><a href="gui.html">gui</a></li>
<li><a href="gui_w32.html">gui_w32</a></li>
<li><a href="gui_x11.html">gui_x11</a></li>
</ul></dd>

<dt>Interfaces</dt>
<dd><ul>
<li><a href="if_cscop.html">if_cscop</a></li>
<li><a href="if_lua.html">if_lua</a></li>
<li><a href="if_mzsch.html">if_mzsch</a></li>
<li><a href="if_perl.html">if_perl</a></li>
<li><a href="if_pyth.html">if_pyth</a></li>
<li><a href="if_tcl.html">if_tcl</a></li>
<li><a href="if_ole.html">if_ole</a></li>
<li><a href="if_ruby.html">if_ruby</a></li>
<li><a href="debugger.html">debugger</a></li>
<li><a href="workshop.html">workshop</a></li>
<li><a href="netbeans.html">netbeans</a></li>
<li><a href="sign.html">sign</a></li>
</ul></dd>

<dt>Versions</dt>
<dd><ul>
<li><a href="vi_diff.html">vi_diff</a></li>
<li><a href="version4.html">version4</a></li>
<li><a href="version5.html">version5</a></li>
<li><a href="version6.html">version6</a></li>
<li><a href="version7.html">version7</a></li>
<li><a href="version8.html">version8</a></li>
</ul></dd>

<dt>Remarks about specific systems</dt>
<dd><ul>
<li><a href="os_390.html">os_390</a></li>
<li><a href="os_amiga.html">os_amiga</a></li>
<li><a href="os_beos.html">os_beos</a></li>
<li><a href="os_dos.html">os_dos</a></li>
<li><a href="os_mac.html">os_mac</a></li>
<li><a href="os_mint.html">os_mint</a></li>
<li><a href="os_msdos.html">os_msdos</a></li>
<li><a href="os_os2.html">os_os2</a></li>
<li><a href="os_qnx.html">os_qnx</a></li>
<li><a href="os_risc.html">os_risc</a></li>
<li><a href="os_unix.html">os_unix</a></li>
<li><a href="os_vms.html">os_vms</a></li>
<li><a href="os_win32.html">os_win32</a></li>
</ul></dd>

<dt>Standard plugins</dt>
<dd><ul>
<li><a href="pi_getscript.html">pi_getscript</a></li>
<li><a href="pi_gzip.html">pi_gzip</a></li>
<li><a href="pi_logipat.html">pi_logipat</a></li>
<li><a href="pi_netrw.html">pi_netrw</a></li>
<li><a href="pi_paren.html">pi_paren</a></li>
<li><a href="pi_tar.html">pi_tar</a></li>
<li><a href="pi_vimball.html">pi_vimball</a></li>
<li><a href="pi_zip.html">pi_zip</a></li>
</ul></dd>

<dt>Filetype plugins</dt>
<dd><ul>
<li><a href="pi_spec.html">pi_spec</a></li>
</ul></dd>

<dt>Others</dt>
<dd><ul>
<li><a href="vim_faq.html">vim_faq</a></li>
</ul></dd>

</dl>
</nav>

<article class="Vimdoc VimdocJa">
<div id='vimCodeElement'>
<a class="Constant" href="ft_sql.html" name="ft_sql.txt">ft_sql.txt</a>&nbsp;&nbsp;&nbsp;&nbsp;For&nbsp;<span class="Identifier">Vim version 8.0.</span>&nbsp;&nbsp;Last change: 2013 May 15<br>
<br>
by David Fishburn<br>
<br>
This is a filetype plugin to work with SQL files.<br>
<br>
The Structured Query Language (SQL) is a standard which specifies statements<br>
that allow a user to interact with a relational database.&nbsp;&nbsp;Vim includes<br>
features for navigation, indentation and syntax highlighting.<br>
<br>
1. Navigation&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="ft_sql.html#sql-navigation">sql-navigation</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;1.1 Matchit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="ft_sql.html#sql-matchit">sql-matchit</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;1.2 Text Object Motions&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="ft_sql.html#sql-object-motions">sql-object-motions</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;1.3 Predefined Object Motions&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="ft_sql.html#sql-predefined-objects">sql-predefined-objects</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;1.4 Macros&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="ft_sql.html#sql-macros">sql-macros</a><br>
2. SQL Dialects&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="ft_sql.html#sql-dialects">sql-dialects</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;2.1 SQLSetType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="ft_sql.html#SQLSetType">SQLSetType</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;2.2 SQLGetType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="ft_sql.html#SQLGetType">SQLGetType</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;2.3 SQL Dialect Default&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="ft_sql.html#sql-type-default">sql-type-default</a><br>
3. Adding new SQL Dialects&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="ft_sql.html#sql-adding-dialects">sql-adding-dialects</a><br>
4. OMNI SQL Completion&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="ft_sql.html#sql-completion">sql-completion</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;4.1 Static mode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="ft_sql.html#sql-completion-static">sql-completion-static</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;4.2 Dynamic mode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="ft_sql.html#sql-completion-dynamic">sql-completion-dynamic</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;4.3 Tutorial&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="ft_sql.html#sql-completion-tutorial">sql-completion-tutorial</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.3.1 Complete Tables&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="ft_sql.html#sql-completion-tables">sql-completion-tables</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.3.2 Complete Columns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="ft_sql.html#sql-completion-columns">sql-completion-columns</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.3.3 Complete Procedures&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="ft_sql.html#sql-completion-procedures">sql-completion-procedures</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.3.4 Complete Views&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="ft_sql.html#sql-completion-views">sql-completion-views</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;4.4 Completion Customization&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="ft_sql.html#sql-completion-customization">sql-completion-customization</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;4.5 SQL Maps&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="ft_sql.html#sql-completion-maps">sql-completion-maps</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;4.6 Using with other filetypes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="ft_sql.html#sql-completion-filetypes">sql-completion-filetypes</a><br>
<br>
<span class="PreProc">==============================================================================</span><br>
1. Navigation&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#sql-navigation" name="sql-navigation">sql-navigation</a><br>
<br>
The SQL ftplugin provides a number of options to assist with file<br>
navigation.<br>
<br>
<br>
1.1 Matchit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#sql-matchit" name="sql-matchit">sql-matchit</a><br>
<span class="PreProc">-----------</span><br>
The matchit plugin (<span class="Constant"><a href="http://www.vim.org/scripts/script.php?script_id=39">http://www.vim.org/scripts/script.php?script_id=39</a></span>)<br>
provides many additional features and can be customized for different<br>
languages.&nbsp;&nbsp;The matchit plugin is configured by defining a local<br>
buffer variable, b:match_words.&nbsp;&nbsp;Pressing the % key while on various<br>
keywords will move the cursor to its match.&nbsp;&nbsp;For example, if the cursor<br>
is on an &quot;if&quot;, pressing % will cycle between the &quot;else&quot;, &quot;elseif&quot; and<br>
&quot;end if&quot; keywords.<br>
<br>
The following keywords are supported:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;if<br>
&nbsp;&nbsp;&nbsp;&nbsp;elseif | elsif<br>
&nbsp;&nbsp;&nbsp;&nbsp;else [if]<br>
&nbsp;&nbsp;&nbsp;&nbsp;end if</div>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;[while condition] loop<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;leave<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit<br>
&nbsp;&nbsp;&nbsp;&nbsp;end loop</div>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;for<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;leave<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit<br>
&nbsp;&nbsp;&nbsp;&nbsp;end loop</div>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;do<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;statements<br>
&nbsp;&nbsp;&nbsp;&nbsp;doend</div>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;case<br>
&nbsp;&nbsp;&nbsp;&nbsp;when<br>
&nbsp;&nbsp;&nbsp;&nbsp;when<br>
&nbsp;&nbsp;&nbsp;&nbsp;default<br>
&nbsp;&nbsp;&nbsp;&nbsp;end case</div>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;merge<br>
&nbsp;&nbsp;&nbsp;&nbsp;when not matched<br>
&nbsp;&nbsp;&nbsp;&nbsp;when matched</div>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;create[ or replace] procedure|function|event<br>
&nbsp;&nbsp;&nbsp;&nbsp;returns</div>
<br>
<br>
1.2 Text Object Motions&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#sql-object-motions" name="sql-object-motions">sql-object-motions</a><br>
<span class="PreProc">-----------------------</span><br>
Vim has a number of predefined keys for working with text&nbsp;<a class="Identifier" href="motion.html#object-motions">object-motions</a>.<br>
This filetype plugin attempts to translate these keys to maps which make sense<br>
for the SQL language.<br>
<br>
The following&nbsp;<a class="Identifier" href="intro.html#Normal">Normal</a>&nbsp;mode and&nbsp;<a class="Identifier" href="visual.html#Visual">Visual</a>&nbsp;mode maps exist (when you edit a SQL<br>
file):<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;]]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;move forward to the next 'begin'<br>
&nbsp;&nbsp;&nbsp;&nbsp;[[&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;move backwards to the previous 'begin'<br>
&nbsp;&nbsp;&nbsp;&nbsp;][&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;move forward to the next 'end'<br>
&nbsp;&nbsp;&nbsp;&nbsp;[]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;move backwards to the previous 'end'</div>
<br>
<br>
1.3 Predefined Object Motions&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#sql-predefined-objects" name="sql-predefined-objects">sql-predefined-objects</a><br>
<span class="PreProc">-----------------------------</span><br>
Most relational databases support various standard features, tables, indices,<br>
triggers and stored procedures.&nbsp;&nbsp;Each vendor also has a variety of proprietary<br>
objects.&nbsp;&nbsp;The next set of maps have been created to help move between these<br>
objects.&nbsp;&nbsp;Depends on which database vendor you are using, the list of objects<br>
must be configurable.&nbsp;&nbsp;The filetype plugin attempts to define many of the<br>
standard objects, plus many additional ones.&nbsp;&nbsp;In order to make this as<br>
flexible as possible, you can override the list of objects from within your<br>
<a class="Identifier" href="starting.html#vimrc">vimrc</a>&nbsp;with the following:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;let g:ftplugin_sql_objects = 'function,procedure,event,table,trigger' .<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\ ',schema,service,publication,database,datatype,domain' .<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\ ',index,subscription,synchronization,view,variable'</div>
<br>
The following&nbsp;<a class="Identifier" href="intro.html#Normal">Normal</a>&nbsp;mode and&nbsp;<a class="Identifier" href="visual.html#Visual">Visual</a>&nbsp;mode maps have been created which use<br>
the above list:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;]}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;move forward to the next 'create &lt;object name&gt;'<br>
&nbsp;&nbsp;&nbsp;&nbsp;[{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;move backward to the previous 'create &lt;object name&gt;'</div>
<br>
Repeatedly pressing ]} will cycle through each of these create statements:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;create table t1 (<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;);</div>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;create procedure p1<br>
&nbsp;&nbsp;&nbsp;&nbsp;begin<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;end;</div>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;create index i1 on t1 (c1);</div>
<br>
The default setting for g:ftplugin_sql_objects is:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;let g:ftplugin_sql_objects = 'function,procedure,event,' .<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\ '\\(existing\\\\|global\\s\\+temporary\\s\\+\\)\\\{,1}' .<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\ 'table,trigger' .<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\ ',schema,service,publication,database,datatype,domain' .<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\ ',index,subscription,synchronization,view,variable'</div>
<br>
The above will also handle these cases:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;create table t1 (<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;create existing table t2 (<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;create global temporary table t3 (<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;);</div>
<br>
By default, the ftplugin only searches for CREATE statements.&nbsp;&nbsp;You can also<br>
override this via your&nbsp;<a class="Identifier" href="starting.html#vimrc">vimrc</a>&nbsp;with the following:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;let g:ftplugin_sql_statements = 'create,alter'</div>
<br>
The filetype plugin defines three types of comments:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;1.&nbsp;&nbsp;--<br>
&nbsp;&nbsp;&nbsp;&nbsp;2.&nbsp;&nbsp;//<br>
&nbsp;&nbsp;&nbsp;&nbsp;3.&nbsp;&nbsp;/*<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</div>
<br>
The following&nbsp;<a class="Identifier" href="intro.html#Normal">Normal</a>&nbsp;mode and&nbsp;<a class="Identifier" href="visual.html#Visual">Visual</a>&nbsp;mode maps have been created to work<br>
with comments:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;]&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;move forward to the beginning of a comment<br>
&nbsp;&nbsp;&nbsp;&nbsp;[&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;move forward to the end of a comment</div>
<br>
<br>
<br>
1.4 Macros&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#sql-macros" name="sql-macros">sql-macros</a><br>
<span class="PreProc">----------</span><br>
Vim's feature to find macro definitions,&nbsp;<a class="Identifier" href="options.html#'define'">'define'</a>, is supported using this<br>
regular expression:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;\c\&lt;\(VARIABLE\|DECLARE\|IN\|OUT\|INOUT\)\&gt;</div>
<br>
This addresses the following code:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;CREATE VARIABLE myVar1 INTEGER;</div>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;CREATE PROCEDURE sp_test(<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IN myVar2 INTEGER,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OUT myVar3 CHAR(30),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;INOUT myVar4 NUMERIC(20,0)<br>
&nbsp;&nbsp;&nbsp;&nbsp;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;BEGIN<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DECLARE myVar5 INTEGER;</div>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SELECT c1, c2, c3<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;INTO myVar2, myVar3, myVar4<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FROM T1<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE c4 = myVar1;<br>
&nbsp;&nbsp;&nbsp;&nbsp;END;</div>
<br>
Place your cursor on &quot;myVar1&quot; on this line:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE c4 = myVar1;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ^</div>
<br>
Press any of the following keys:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;[d<br>
&nbsp;&nbsp;&nbsp;&nbsp;[D<br>
&nbsp;&nbsp;&nbsp;&nbsp;[CTRL-D</div>
<br>
<br>
<span class="PreProc">==============================================================================</span><br>
2. SQL Dialects&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#sql-dialects" name="sql-dialects">sql-dialects</a>&nbsp;<a class="Constant" href="ft_sql.html#sql-types" name="sql-types">sql-types</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#sybase" name="sybase">sybase</a>&nbsp;<a class="Constant" href="ft_sql.html#TSQL" name="TSQL">TSQL</a>&nbsp;<a class="Constant" href="ft_sql.html#Transact-SQL" name="Transact-SQL">Transact-SQL</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#sqlanywhere" name="sqlanywhere">sqlanywhere</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#oracle" name="oracle">oracle</a>&nbsp;<a class="Constant" href="ft_sql.html#plsql" name="plsql">plsql</a>&nbsp;<a class="Constant" href="ft_sql.html#sqlj" name="sqlj">sqlj</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#sqlserver" name="sqlserver">sqlserver</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#mysql" name="mysql">mysql</a>&nbsp;<a class="Constant" href="ft_sql.html#postgresql" name="postgresql">postgresql</a>&nbsp;<a class="Constant" href="ft_sql.html#psql" name="psql">psql</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#informix" name="informix">informix</a><br>
<br>
All relational databases support SQL.&nbsp;&nbsp;There is a portion of SQL that is<br>
portable across vendors (ex. CREATE TABLE, CREATE INDEX), but there is a<br>
great deal of vendor specific extensions to SQL.&nbsp;&nbsp;Oracle supports the<br>
&quot;CREATE OR REPLACE&quot; syntax, column defaults specified in the CREATE TABLE<br>
statement and the procedural language (for stored procedures and triggers).<br>
<br>
The default Vim distribution ships with syntax highlighting based on Oracle's<br>
PL/SQL.&nbsp;&nbsp;The default SQL indent script works for Oracle and SQL Anywhere.<br>
The default filetype plugin works for all vendors and should remain vendor<br>
neutral, but extendable.<br>
<br>
Vim currently has support for a variety of different vendors, currently this<br>
is via syntax scripts. Unfortunately, to flip between different syntax rules<br>
you must either create:<br>
&nbsp;&nbsp;&nbsp;&nbsp;1.&nbsp;&nbsp;New filetypes<br>
&nbsp;&nbsp;&nbsp;&nbsp;2.&nbsp;&nbsp;Custom autocmds<br>
&nbsp;&nbsp;&nbsp;&nbsp;3.&nbsp;&nbsp;Manual steps / commands<br>
<br>
The majority of people work with only one vendor's database product, it would<br>
be nice to specify a default in your&nbsp;<a class="Identifier" href="starting.html#vimrc">vimrc</a>.<br>
<br>
<br>
2.1 SQLSetType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#sqlsettype" name="sqlsettype">sqlsettype</a>&nbsp;<a class="Constant" href="ft_sql.html#SQLSetType" name="SQLSetType">SQLSetType</a><br>
<span class="PreProc">--------------</span><br>
For the people that work with many different databases, it is nice to be<br>
able to flip between the various vendors rules (indent, syntax) on a per<br>
buffer basis, at any time.&nbsp;&nbsp;The ftplugin/sql.vim file defines this function:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;SQLSetType</div>
<br>
Executing this function without any parameters will set the indent and syntax<br>
scripts back to their defaults, see&nbsp;<a class="Identifier" href="ft_sql.html#sql-type-default">sql-type-default</a>.&nbsp;&nbsp;If you have turned<br>
off Vi's compatibility mode,&nbsp;<a class="Identifier" href="options.html#'compatible'">'compatible'</a>, you can use the&nbsp;<span class="Special">&lt;Tab&gt;</span>&nbsp;key to<br>
complete the optional parameter.<br>
<br>
After typing the function name and a space, you can use the completion to<br>
supply a parameter.&nbsp;&nbsp;The function takes the name of the Vim script you want to<br>
source.&nbsp;&nbsp;Using the&nbsp;<a class="Identifier" href="cmdline.html#cmdline-completion">cmdline-completion</a>&nbsp;feature, the SQLSetType function will<br>
search the&nbsp;<a class="Identifier" href="options.html#'runtimepath'">'runtimepath'</a>&nbsp;for all Vim scripts with a name containing&nbsp;<span class="MissingTag">'sql'</span>.<br>
This takes the guess work out of the spelling of the names.&nbsp;&nbsp;The following are<br>
examples:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:SQLSetType<br>
&nbsp;&nbsp;&nbsp;&nbsp;:SQLSetType sqloracle<br>
&nbsp;&nbsp;&nbsp;&nbsp;:SQLSetType sqlanywhere<br>
&nbsp;&nbsp;&nbsp;&nbsp;:SQLSetType sqlinformix<br>
&nbsp;&nbsp;&nbsp;&nbsp;:SQLSetType mysql</div>
<br>
The easiest approach is to the use&nbsp;<span class="Special">&lt;Tab&gt;</span>&nbsp;character which will first complete<br>
the command name (SQLSetType), after a space and another&nbsp;<span class="Special">&lt;Tab&gt;</span>, display a list<br>
of available Vim script names:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:SQL&lt;Tab&gt;&lt;space&gt;&lt;Tab&gt;</div>
<br>
<br>
2.2 SQLGetType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#sqlgettype" name="sqlgettype">sqlgettype</a>&nbsp;<a class="Constant" href="ft_sql.html#SQLGetType" name="SQLGetType">SQLGetType</a><br>
<span class="PreProc">--------------</span><br>
At anytime you can determine which SQL dialect you are using by calling the<br>
SQLGetType command.&nbsp;&nbsp;The ftplugin/sql.vim file defines this function:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;SQLGetType</div>
<br>
This will echo:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;Current SQL dialect in use:sqlanywhere</div>
<br>
<br>
2.3 SQL Dialect Default&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#sql-type-default" name="sql-type-default">sql-type-default</a><br>
<span class="PreProc">-----------------------</span><br>
As mentioned earlier, the default syntax rules for Vim is based on Oracle<br>
(PL/SQL).&nbsp;&nbsp;You can override this default by placing one of the following in<br>
your&nbsp;<a class="Identifier" href="starting.html#vimrc">vimrc</a>:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;let g:sql_type_default = 'sqlanywhere'<br>
&nbsp;&nbsp;&nbsp;&nbsp;let g:sql_type_default = 'sqlinformix'<br>
&nbsp;&nbsp;&nbsp;&nbsp;let g:sql_type_default = 'mysql'</div>
<br>
If you added the following to your&nbsp;<a class="Identifier" href="starting.html#vimrc">vimrc</a>:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;let g:sql_type_default = 'sqlinformix'</div>
<br>
The next time edit a SQL file the following scripts will be automatically<br>
loaded by Vim&#0058;<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;ftplugin/sql.vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;syntax/sqlinformix.vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;indent/sql.vim</div>
<br>
Notice indent/sqlinformix.sql was not loaded.&nbsp;&nbsp;There is no indent file<br>
for Informix, Vim loads the default files if the specified files does not<br>
exist.<br>
<br>
<br>
<span class="PreProc">==============================================================================</span><br>
3. Adding new SQL Dialects&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#sql-adding-dialects" name="sql-adding-dialects">sql-adding-dialects</a><br>
<br>
If you begin working with a SQL dialect which does not have any customizations<br>
available with the default Vim distribution you can check&nbsp;<span class="Constant"><a href="http://www.vim.org">http://www.vim.org</a></span><br>
to see if any customization currently exist.&nbsp;&nbsp;If not, you can begin by cloning<br>
an existing script.&nbsp;&nbsp;Read&nbsp;<a class="Identifier" href="filetype.html#filetype-plugins">filetype-plugins</a>&nbsp;for more details.<br>
<br>
To help identify these scripts, try to create the files with a &quot;sql&quot; prefix.<br>
If you decide you wish to create customizations for the SQLite database, you<br>
can create any of the following:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;Unix<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~/.vim/syntax/sqlite.vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~/.vim/indent/sqlite.vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;Windows<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$VIM/vimfiles/syntax/sqlite.vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$VIM/vimfiles/indent/sqlite.vim</div>
<br>
No changes are necessary to the SQLSetType function.&nbsp;&nbsp;It will automatically<br>
pickup the new SQL files and load them when you issue the SQLSetType command.<br>
<br>
<br>
<span class="PreProc">==============================================================================</span><br>
4. OMNI SQL Completion&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#sql-completion" name="sql-completion">sql-completion</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#omni-sql-completion" name="omni-sql-completion">omni-sql-completion</a><br>
<br>
Vim 7 includes a code completion interface and functions which allows plugin<br>
developers to build in code completion for any language.&nbsp;&nbsp;Vim 7 includes<br>
code completion for the SQL language.<br>
<br>
There are two modes to the SQL completion plugin, static and dynamic.&nbsp;&nbsp;The<br>
static mode populates the popups with the data generated from current syntax<br>
highlight rules.&nbsp;&nbsp;The dynamic mode populates the popups with data retrieved<br>
directly from a database.&nbsp;&nbsp;This includes, table lists, column lists,<br>
procedures names and more.<br>
<br>
4.1 Static Mode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#sql-completion-static" name="sql-completion-static">sql-completion-static</a><br>
<span class="PreProc">---------------</span><br>
The static popups created contain items defined by the active syntax rules<br>
while editing a file with a filetype of SQL.&nbsp;&nbsp;The plugin defines (by default)<br>
various maps to help the user refine the list of items to be displayed.<br>
The defaults static maps are:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;imap &lt;buffer&gt; &lt;C-C&gt;a &lt;C-\&gt;&lt;C-O&gt;:call sqlcomplete#Map('syntax')&lt;CR&gt;&lt;C-X&gt;&lt;C-O&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;imap &lt;buffer&gt; &lt;C-C&gt;k &lt;C-\&gt;&lt;C-O&gt;:call sqlcomplete#Map('sqlKeyword')&lt;CR&gt;&lt;C-X&gt;&lt;C-O&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;imap &lt;buffer&gt; &lt;C-C&gt;f &lt;C-\&gt;&lt;C-O&gt;:call sqlcomplete#Map('sqlFunction')&lt;CR&gt;&lt;C-X&gt;&lt;C-O&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;imap &lt;buffer&gt; &lt;C-C&gt;o &lt;C-\&gt;&lt;C-O&gt;:call sqlcomplete#Map('sqlOption')&lt;CR&gt;&lt;C-X&gt;&lt;C-O&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;imap &lt;buffer&gt; &lt;C-C&gt;T &lt;C-\&gt;&lt;C-O&gt;:call sqlcomplete#Map('sqlType')&lt;CR&gt;&lt;C-X&gt;&lt;C-O&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;imap &lt;buffer&gt; &lt;C-C&gt;s &lt;C-\&gt;&lt;C-O&gt;:call sqlcomplete#Map('sqlStatement')&lt;CR&gt;&lt;C-X&gt;&lt;C-O&gt;</div>
<br>
The use of &quot;<span class="Special">&lt;C-C&gt;</span>&quot; can be user chosen by using the following in your&nbsp;<a class="Identifier" href="starting.html#.vimrc">.vimrc</a>&nbsp;as it&nbsp;<br>
may not work properly on all platforms:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;let g:ftplugin_sql_omni_key = '&lt;C-C&gt;'</div>
<br>
The static maps (which are based on the syntax highlight groups) follow this<br>
format:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;imap &lt;buffer&gt; &lt;C-C&gt;k &lt;C-\&gt;&lt;C-O&gt;:call sqlcomplete#Map('sqlKeyword')&lt;CR&gt;&lt;C-X&gt;&lt;C-O&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;imap &lt;buffer&gt; &lt;C-C&gt;k &lt;C-\&gt;&lt;C-O&gt;:call sqlcomplete#Map('sqlKeyword\w*')&lt;CR&gt;&lt;C-X&gt;&lt;C-O&gt;</div>
<br>
This command breaks down as:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;imap&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Create an insert map<br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;buffer&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Only for this buffer<br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;C-C&gt;k&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Your choice of key map<br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;C-\&gt;&lt;C-O&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Execute one command, return to Insert mode<br>
&nbsp;&nbsp;&nbsp;&nbsp;:call sqlcomplete#Map( - Allows the SQL completion plugin to perform some<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; housekeeping functions to allow it to be used in<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; conjunction with other completion plugins.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Indicate which item you want the SQL completion<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; plugin to complete.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In this case we are asking the plugin to display<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; items from the syntax highlight group<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'sqlKeyword'.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; You can view a list of highlight group names to<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; choose from by executing the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :syntax list<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; command while editing a SQL file.<br>
&nbsp;&nbsp;&nbsp;&nbsp;'sqlKeyword'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Display the items for the sqlKeyword highlight<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; group<br>
&nbsp;&nbsp;&nbsp;&nbsp;'sqlKeyword\w*'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- A second option available with Vim 7.4 which<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uses a regular expression to determine which<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; syntax groups to use<br>
&nbsp;&nbsp;&nbsp;&nbsp;)&lt;CR&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Execute the :let command<br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;C-X&gt;&lt;C-O&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Trigger the standard omni completion key stroke.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Passing in 'sqlKeyword' instructs the SQL<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; completion plugin to populate the popup with<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; items from the sqlKeyword highlight group.&nbsp;&nbsp;The<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; plugin will also cache this result until Vim is<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; restarted.&nbsp;&nbsp;The syntax list is retrieved using<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the syntaxcomplete plugin.</div>
<br>
Using the&nbsp;<a class="Type" href="options.html#'syntax'">'syntax'</a>&nbsp;keyword is a special case.&nbsp;&nbsp;This instructs the<br>
syntaxcomplete plugin to retrieve all syntax items.&nbsp;&nbsp;So this will effectively<br>
work for any of Vim's SQL syntax files.&nbsp;&nbsp;At the time of writing this includes<br>
10 different syntax files for the different dialects of SQL (see section 3<br>
above,&nbsp;<a class="Identifier" href="ft_sql.html#sql-dialects">sql-dialects</a>).<br>
<br>
Here are some examples of the entries which are pulled from the syntax files:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; All<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Contains the contents of all syntax highlight groups<br>
&nbsp;&nbsp;&nbsp;&nbsp; Statements<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Select, Insert, Update, Delete, Create, Alter, ...<br>
&nbsp;&nbsp;&nbsp;&nbsp; Functions<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Min, Max, Trim, Round, Date, ...<br>
&nbsp;&nbsp;&nbsp;&nbsp; Keywords<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Index, Database, Having, Group, With<br>
&nbsp;&nbsp;&nbsp;&nbsp; Options<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Isolation_level, On_error, Qualify_owners, Fire_triggers, ...<br>
&nbsp;&nbsp;&nbsp;&nbsp; Types<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Integer, Char, Varchar, Date, DateTime, Timestamp, ...</div>
<br>
<br>
4.2 Dynamic Mode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#sql-completion-dynamic" name="sql-completion-dynamic">sql-completion-dynamic</a><br>
<span class="PreProc">----------------</span><br>
Dynamic mode populates the popups with data directly from a database.&nbsp;&nbsp;In<br>
order for the dynamic feature to be enabled you must have the dbext.vim<br>
plugin installed, (<span class="Constant"><a href="http://vim.sourceforge.net/script.php?script_id=356">http://vim.sourceforge.net/script.php?script_id=356</a></span>).<br>
<br>
Dynamic mode is used by several features of the SQL completion plugin.<br>
After installing the dbext plugin see the dbext-tutorial for additional<br>
configuration and usage.&nbsp;&nbsp;The dbext plugin allows the SQL completion plugin<br>
to display a list of tables, procedures, views and columns.<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Table List<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - All tables for all schema owners<br>
&nbsp;&nbsp;&nbsp;&nbsp; Procedure List<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - All stored procedures for all schema owners<br>
&nbsp;&nbsp;&nbsp;&nbsp; View List<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - All stored procedures for all schema owners<br>
&nbsp;&nbsp;&nbsp;&nbsp; Column List<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - For the selected table, the columns that are part of the table</div>
<br>
To enable the popup, while in INSERT mode, use the following key combinations<br>
for each group (where&nbsp;<span class="Special">&lt;C-C&gt;</span>&nbsp;means hold the CTRL key down while pressing<br>
the space bar):<br>
&nbsp;&nbsp;&nbsp;&nbsp; Table List&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;<span class="Special">&lt;C-C&gt;</span>t<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp;<span class="Special">&lt;C-X&gt;&lt;C-O&gt;</span>&nbsp;(the default map assumes tables)<br>
&nbsp;&nbsp;&nbsp;&nbsp; Stored Procedure List -&nbsp;<span class="Special">&lt;C-C&gt;</span>p<br>
&nbsp;&nbsp;&nbsp;&nbsp; View List&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp;<span class="Special">&lt;C-C&gt;</span>v<br>
&nbsp;&nbsp;&nbsp;&nbsp; Column List&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp;<span class="Special">&lt;C-C&gt;</span>c<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp; Drilling In / Out&nbsp;&nbsp;&nbsp;&nbsp; - When viewing a popup window displaying the list<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; of tables, you can press&nbsp;<span class="Special">&lt;Right&gt;</span>, this will<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; replace the table currently highlighted with<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the column list for that table.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - When viewing a popup window displaying the list<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; of columns, you can press&nbsp;<span class="Special">&lt;Left&gt;</span>, this will<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; replace the column list with the list of tables.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - This allows you to quickly drill down into a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; table to view its columns and back again.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp;<span class="Special">&lt;Right&gt;</span>&nbsp;and&nbsp;<span class="Special">&lt;Left&gt;</span>&nbsp;can be also be chosen via<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; your&nbsp;<a class="Identifier" href="starting.html#.vimrc">.vimrc</a><br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;let g:ftplugin_sql_omni_key_right = '&lt;Right&gt;'<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;let g:ftplugin_sql_omni_key_left&nbsp;&nbsp;= '&lt;Left&gt;'</div>
<br>
The SQL completion plugin caches various lists that are displayed in<br>
the popup window.&nbsp;&nbsp;This makes the re-displaying of these lists very<br>
fast.&nbsp;&nbsp;If new tables or columns are added to the database it may become<br>
necessary to clear the plugins cache.&nbsp;&nbsp;The default map for this is:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;imap &lt;buffer&gt; &lt;C-C&gt;R &lt;C-\&gt;&lt;C-O&gt;:call sqlcomplete#Map('ResetCache')&lt;CR&gt;&lt;C-X&gt;&lt;C-O&gt;</div>
<br>
<br>
4.3 SQL Tutorial&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#sql-completion-tutorial" name="sql-completion-tutorial">sql-completion-tutorial</a><br>
<span class="PreProc">----------------</span><br>
<br>
This tutorial is designed to take you through the common features of the SQL<br>
completion plugin so that:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; a) You gain familiarity with the plugin<br>
&nbsp;&nbsp;&nbsp;&nbsp; b) You are introduced to some of the more common features<br>
&nbsp;&nbsp;&nbsp;&nbsp; c) Show how to customize it to your preferences<br>
&nbsp;&nbsp;&nbsp;&nbsp; d) Demonstrate &quot;Best of Use&quot; of the plugin (easiest way to configure).</div>
<br>
First, create a new buffer:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; :e tutorial.sql</div>
<br>
<br>
Static features<br>
<span class="PreProc">---------------</span><br>
To take you through the various lists, simply enter insert mode, hit:<br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="Special">&lt;C-C&gt;</span>s&nbsp;&nbsp; (show SQL statements)<br>
At this point, you can page down through the list until you find &quot;select&quot;.<br>
If you are familiar with the item you are looking for, for example you know<br>
the statement begins with the letter &quot;s&quot;.&nbsp;&nbsp;You can type ahead (without the<br>
quotes) &quot;se&quot; then press:<br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="Special">&lt;C-Space&gt;</span>t<br>
Assuming &quot;select&quot; is highlighted in the popup list press&nbsp;<span class="Special">&lt;Enter&gt;</span>&nbsp;to choose<br>
the entry.&nbsp;&nbsp;Now type:<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;</span>* fr<span class="Special">&lt;C-C&gt;</span>a (show all syntax items)<br>
choose &quot;from&quot; from the popup list.<br>
<br>
When writing stored procedures using the &quot;type&quot; list is useful.&nbsp;&nbsp;It contains<br>
a list of all the database supported types.&nbsp;&nbsp;This may or may not be true<br>
depending on the syntax file you are using.&nbsp;&nbsp;The SQL Anywhere syntax file<br>
(sqlanywhere.vim) has support for this:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; BEGIN<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DECLARE customer_id &lt;C-C&gt;T &lt;-- Choose a type from the list</div>
<br>
<br>
Dynamic features<br>
<span class="PreProc">----------------</span><br>
To take advantage of the dynamic features you must first install the<br>
dbext.vim plugin (<span class="Constant"><a href="http://vim.sourceforge.net/script.php?script_id=356">http://vim.sourceforge.net/script.php?script_id=356</a></span>).&nbsp;&nbsp;It<br>
also comes with a tutorial.&nbsp;&nbsp;From the SQL completion plugin's perspective,<br>
the main feature dbext provides is a connection to a database.&nbsp;&nbsp;dbext<br>
connection profiles are the most efficient mechanism to define connection<br>
information.&nbsp;&nbsp;Once connections have been setup, the SQL completion plugin<br>
uses the features of dbext in the background to populate the popups.<br>
<br>
What follows assumes dbext.vim has been correctly configured, a simple test<br>
is to run the command, :DBListTable.&nbsp;&nbsp;If a list of tables is shown, you know<br>
dbext.vim is working as expected.&nbsp;&nbsp;If not, please consult the dbext.txt<br>
documentation.<br>
<br>
Assuming you have followed the dbext-tutorial you can press&nbsp;<span class="Special">&lt;C-C&gt;</span>t to<br>
display a list of tables.&nbsp;&nbsp;There is a delay while dbext is creating the table<br>
list.&nbsp;&nbsp;After the list is displayed press&nbsp;<span class="Special">&lt;C-W&gt;</span>.&nbsp;&nbsp;This will remove both the<br>
popup window and the table name already chosen when the list became active.<br>
<br>
<div class="helpExample">&nbsp;4.3.1 Table Completion:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*sql-completion-tables*</div>
<br>
Press&nbsp;<span class="Special">&lt;C-C&gt;</span>t to display a list of tables from within the database you<br>
have connected via the dbext plugin.<br>
<span class="Todo">NOTE</span>: All of the SQL completion popups support typing a prefix before pressing<br>
the key map.&nbsp;&nbsp;This will limit the contents of the popup window to just items<br>
beginning with those characters.&nbsp;<br>
<br>
<div class="helpExample">&nbsp;4.3.2 Column Completion:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *sql-completion-columns*</div>
<br>
The SQL completion plugin can also display a list of columns for particular<br>
tables.&nbsp;&nbsp;The column completion is trigger via&nbsp;<span class="Special">&lt;C-C&gt;</span>c.<br>
<br>
<span class="Todo">NOTE</span>: The following example uses&nbsp;<span class="Special">&lt;Right&gt;</span>&nbsp;to trigger a column list while<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the popup window is active.&nbsp;&nbsp;<br>
<br>
Example of using column completion:<br>
&nbsp;&nbsp;&nbsp;&nbsp; - Press&nbsp;<span class="Special">&lt;C-C&gt;</span>t again to display the list of tables.<br>
&nbsp;&nbsp;&nbsp;&nbsp; - When the list is displayed in the completion window, press&nbsp;<span class="Special">&lt;Right&gt;</span>,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this will replace the list of tables, with a list of columns for the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; table highlighted (after the same short delay).<br>
&nbsp;&nbsp;&nbsp;&nbsp; - If you press&nbsp;<span class="Special">&lt;Left&gt;</span>, this will again replace the column list with the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; list of tables.&nbsp;&nbsp;This allows you to drill into tables and column lists<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; very quickly.<br>
&nbsp;&nbsp;&nbsp;&nbsp; - Press&nbsp;<span class="Special">&lt;Right&gt;</span>&nbsp;again while the same table is highlighted.&nbsp;&nbsp;You will<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; notice there is no delay since the column list has been cached.&nbsp;&nbsp;If you<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; change the schema of a cached table you can press&nbsp;<span class="Special">&lt;C-C&gt;</span>R, which<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; clears the SQL completion cache.<br>
&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp;<span class="Todo">NOTE</span>:&nbsp;<span class="Special">&lt;Right&gt;</span>&nbsp;and&nbsp;<span class="Special">&lt;Left&gt;</span>&nbsp;have been designed to work while the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; completion window is active.&nbsp;&nbsp;If the completion popup window is<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; not active, a normal&nbsp;<span class="Special">&lt;Right&gt;</span>&nbsp;or&nbsp;<span class="Special">&lt;Left&gt;</span>&nbsp;will be executed.<br>
<br>
Let's look at how we can build a SQL statement dynamically.&nbsp;&nbsp;A select statement<br>
requires a list of columns.&nbsp;&nbsp;There are two ways to build a column list using<br>
the SQL completion plugin.<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;One column at a time:</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1. After typing SELECT press&nbsp;<span class="Special">&lt;C-C&gt;</span>t to display a list of tables.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2. Choose a table from the list.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3. Press&nbsp;<span class="Special">&lt;Right&gt;</span>&nbsp;to display a list of columns.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4. Choose the column from the list and press enter.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5. Enter a &quot;,&quot; and press&nbsp;<span class="Special">&lt;C-C&gt;</span>c.&nbsp;&nbsp;Generating a column list<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; generally requires having the cursor on a table name.&nbsp;&nbsp;The plugin<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uses this name to determine what table to retrieve the column list.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In this step, since we are pressing&nbsp;<span class="Special">&lt;C-C&gt;</span>c without the cursor<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; on a table name the column list displayed will be for the previous<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; table.&nbsp;&nbsp;Choose a different column and move on.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6. Repeat step 5 as often as necessary.<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;All columns for a table:</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1. After typing SELECT press&nbsp;<span class="Special">&lt;C-C&gt;</span>t to display a list of tables.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2. Highlight the table you need the column list for.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3. Press&nbsp;<span class="Special">&lt;Enter&gt;</span>&nbsp;to choose the table from the list.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4. Press&nbsp;<span class="Special">&lt;C-C&gt;</span>l to request a comma separated list of all columns<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for this table.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5. Based on the table name chosen in step 3, the plugin attempts to<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; decide on a reasonable table alias.&nbsp;&nbsp;You are then prompted to<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; either accept of change the alias.&nbsp;&nbsp;Press OK.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6. The table name is replaced with the column list of the table is<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; replaced with the comma separate list of columns with the alias<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prepended to each of the columns.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;7. Step 3 and 4 can be replaced by pressing&nbsp;<span class="Special">&lt;C-C&gt;</span>L, which has<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a&nbsp;<span class="Special">&lt;C-Y&gt;</span>&nbsp;embedded in the map to choose the currently highlighted<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; table in the list.<br>
<br>
There is a special provision when writing select statements.&nbsp;&nbsp;Consider the<br>
following statement:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; select *<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from customer c,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;contact cn,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;department as dp,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;employee e,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;site_options so<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;where c.</div>
<br>
In INSERT mode after typing the final &quot;c.&quot; which is an alias for the<br>
&quot;customer&quot; table, you can press either&nbsp;<span class="Special">&lt;C-C&gt;</span>c or&nbsp;<span class="Special">&lt;C-X&gt;&lt;C-O&gt;</span>.&nbsp;&nbsp;This will<br>
popup a list of columns for the customer table.&nbsp;&nbsp;It does this by looking back<br>
to the beginning of the select statement and finding a list of the tables<br>
specified in the FROM clause.&nbsp;&nbsp;In this case it notes that in the string<br>
&quot;customer c&quot;, &quot;c&quot; is an alias for the customer table.&nbsp;&nbsp;The optional &quot;AS&quot;<br>
keyword is also supported, &quot;customer AS c&quot;.<br>
<br>
<br>
<div class="helpExample">&nbsp;4.3.3 Procedure Completion:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*sql-completion-procedures*</div>
<br>
Similar to the table list,&nbsp;<span class="Special">&lt;C-C&gt;</span>p, will display a list of stored<br>
procedures stored within the database.<br>
<br>
<div class="helpExample">&nbsp;4.3.4 View Completion:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *sql-completion-views*</div>
<br>
Similar to the table list,&nbsp;<span class="Special">&lt;C-C&gt;</span>v, will display a list of views in the<br>
database.<br>
<br>
<br>
4.4 Completion Customization&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#sql-completion-customization" name="sql-completion-customization">sql-completion-customization</a><br>
<span class="PreProc">----------------------------</span><br>
<br>
The SQL completion plugin can be customized through various options set in<br>
your&nbsp;<a class="Identifier" href="starting.html#vimrc">vimrc</a>:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;omni_sql_no_default_maps</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Default: This variable is not defined<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- If this variable is defined, no maps are created for OMNI<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;completion.&nbsp;&nbsp;See&nbsp;<a class="Identifier" href="ft_sql.html#sql-completion-maps">sql-completion-maps</a>&nbsp;for further discussion.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;omni_sql_use_tbl_alias</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Default: a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- This setting is only used when generating a comma separated<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;column list.&nbsp;&nbsp;By default the map is&nbsp;<span class="Special">&lt;C-C&gt;</span>l.&nbsp;&nbsp;When generating<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a column list, an alias can be prepended to the beginning of each<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;column, for example:&nbsp;&nbsp;e.emp_id, e.emp_name.&nbsp;&nbsp;This option has three<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;settings:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;n - do not use an alias<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;d - use the default (calculated) alias<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a - ask to confirm the alias name</div>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;An alias is determined following a few rules:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1.&nbsp;&nbsp;If the table name has an '_', then use it as a separator:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MY_TABLE_NAME --&gt; MTN<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my_table_name --&gt; mtn<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; My_table_NAME --&gt; MtN</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2.&nbsp;&nbsp;If the table name does NOT contain an '_', but DOES use<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mixed case then the case is used as a separator:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyTableName --&gt; MTN</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3.&nbsp;&nbsp;If the table name does NOT contain an '_', and does NOT<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; use mixed case then the first letter of the table is used:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mytablename --&gt; m<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MYTABLENAME --&gt; M</div>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;omni_sql_ignorecase</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Default: Current setting for&nbsp;<a class="Type" href="options.html#'ignorecase'">'ignorecase'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Valid settings are 0 or 1.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- When entering a few letters before initiating completion, the list<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;will be filtered to display only the entries which begin with the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list of characters.&nbsp;&nbsp;When this option is set to 0, the list will be<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;filtered using case sensitivity.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;omni_sql_include_owner</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Default: 0, unless dbext.vim 3.00 has been installed<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Valid settings are 0 or 1.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- When completing tables, procedure or views and using dbext.vim 3.00<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or higher the list of objects will also include the owner name.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;When completing these objects and omni_sql_include_owner is enabled<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the owner name will be replaced.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;omni_sql_precache_syntax_groups</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Default:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<a class="Type" href="options.html#'syntax'">'syntax'</a>,'sqlKeyword','sqlFunction','sqlOption','sqlType','sqlStatement']<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- sqlcomplete can be used in conjunction with other completion<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;plugins.&nbsp;&nbsp;This is outlined at&nbsp;<a class="Identifier" href="ft_sql.html#sql-completion-filetypes">sql-completion-filetypes</a>.&nbsp;&nbsp;When the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;filetype is changed temporarily to SQL, the sqlcompletion plugin<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;will cache the syntax groups listed in the List specified in this<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;option.<br>
<br>
<br>
4.5 SQL Maps&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#sql-completion-maps" name="sql-completion-maps">sql-completion-maps</a><br>
<span class="PreProc">------------</span><br>
<br>
The default SQL maps have been described in other sections of this document in<br>
greater detail.&nbsp;&nbsp;Here is a list of the maps with a brief description of each.<br>
<br>
Static Maps<br>
<span class="PreProc">-----------</span><br>
These are maps which use populate the completion list using Vim's syntax<br>
highlighting rules.<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&lt;C-C&gt;a</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Displays all SQL syntax items.<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&lt;C-C&gt;k</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Displays all SQL syntax items defined as 'sqlKeyword'.<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&lt;C-C&gt;f</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Displays all SQL syntax items defined as 'sqlFunction.<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&lt;C-C&gt;o</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Displays all SQL syntax items defined as 'sqlOption'.<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&lt;C-C&gt;T</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Displays all SQL syntax items defined as 'sqlType'.<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&lt;C-C&gt;s</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Displays all SQL syntax items defined as 'sqlStatement'.<br>
<br>
Dynamic Maps<br>
<span class="PreProc">------------</span><br>
These are maps which use populate the completion list using the dbext.vim<br>
plugin.<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&lt;C-C&gt;t</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Displays a list of tables.<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&lt;C-C&gt;p</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Displays a list of procedures.<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&lt;C-C&gt;v</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Displays a list of views.<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&lt;C-C&gt;c</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Displays a list of columns for a specific table.<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&lt;C-C&gt;l</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Displays a comma separated list of columns for a specific table.<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&lt;C-C&gt;L</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Displays a comma separated list of columns for a specific table.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This should only be used when the completion window is active.<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&lt;Right&gt;</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Displays a list of columns for the table currently highlighted in<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the completion window.&nbsp;&nbsp;<span class="Special">&lt;Right&gt;</span>&nbsp;is not recognized on most Unix<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;systems, so this maps is only created on the Windows platform.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If you would like the same feature on Unix, choose a different key<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;and make the same map in your vimrc.<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&lt;Left&gt;</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Displays the list of tables.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Special">&lt;Left&gt;</span>&nbsp;is not recognized on most Unix systems, so this maps is<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;only created on the Windows platform.&nbsp;&nbsp;If you would like the same<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;feature on Unix, choose a different key and make the same map in<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;your vimrc.<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&lt;C-C&gt;R</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - This maps removes all cached items and forces the SQL completion<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to regenerate the list of items.<br>
<br>
Customizing Maps<br>
<span class="PreProc">----------------</span><br>
You can create as many additional key maps as you like.&nbsp;&nbsp;Generally, the maps<br>
will be specifying different syntax highlight groups.<br>
<br>
If you do not wish the default maps created or the key choices do not work on<br>
your platform (often a case on *nix) you define the following variable in<br>
your&nbsp;<a class="Identifier" href="starting.html#vimrc">vimrc</a>:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;let g:omni_sql_no_default_maps = 1</div>
<br>
Do no edit ftplugin/sql.vim directly!&nbsp;&nbsp;If you change this file your changes<br>
will be over written on future updates.&nbsp;&nbsp;Vim has a special directory structure<br>
which allows you to make customizations without changing the files that are<br>
included with the Vim distribution.&nbsp;&nbsp;If you wish to customize the maps<br>
create an after/ftplugin/sql.vim (see&nbsp;<a class="Identifier" href="options.html#after-directory">after-directory</a>) and place the same<br>
maps from the ftplugin/sql.vim in it using your own key strokes.&nbsp;&nbsp;<span class="Special">&lt;C-C&gt;</span>&nbsp;was<br>
chosen since it will work on both Windows and *nix platforms.&nbsp;&nbsp;On the windows<br>
platform you can also use&nbsp;<span class="Special">&lt;C-Space&gt;</span>&nbsp;or ALT keys.<br>
<br>
<br>
4.6 Using with other filetypes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="ft_sql.html#sql-completion-filetypes" name="sql-completion-filetypes">sql-completion-filetypes</a><br>
<span class="PreProc">------------------------------</span><br>
<br>
Many times SQL can be used with different filetypes.&nbsp;&nbsp;For example Perl, Java,<br>
PHP, Javascript can all interact with a database.&nbsp;&nbsp;Often you need both the SQL<br>
completion and the completion capabilities for the current language you are<br>
editing.<br>
<br>
This can be enabled easily with the following steps (assuming a Perl file):<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;1.&nbsp;&nbsp;:e test.pl<br>
&nbsp;&nbsp;&nbsp;&nbsp;2.&nbsp;&nbsp;:set filetype=sql<br>
&nbsp;&nbsp;&nbsp;&nbsp;3.&nbsp;&nbsp;:set ft=perl</div>
<br>
Step 1<br>
<span class="PreProc">------</span><br>
Begins by editing a Perl file.&nbsp;&nbsp;Vim automatically sets the filetype to<br>
&quot;perl&quot;.&nbsp;&nbsp;By default, Vim runs the appropriate filetype file<br>
ftplugin/perl.vim.&nbsp;&nbsp;If you are using the syntax completion plugin by following<br>
the directions at&nbsp;<a class="Identifier" href="insert.html#ft-syntax-omni">ft-syntax-omni</a>&nbsp;then the&nbsp;<a class="Identifier" href="options.html#'omnifunc'">'omnifunc'</a>&nbsp;option has been set to<br>
&quot;syntax#Complete&quot;.&nbsp;&nbsp;Pressing&nbsp;<span class="Special">&lt;C-X&gt;&lt;C-O&gt;</span>&nbsp;will display the omni popup containing<br>
the syntax items for Perl.<br>
<br>
Step 2<br>
<span class="PreProc">------</span><br>
Manually setting the filetype to&nbsp;<span class="MissingTag">'sql'</span>&nbsp;will also fire the appropriate filetype<br>
files ftplugin/sql.vim.&nbsp;&nbsp;This file will define a number of buffer specific<br>
maps for SQL completion, see&nbsp;<a class="Identifier" href="ft_sql.html#sql-completion-maps">sql-completion-maps</a>.&nbsp;&nbsp;Now these maps have<br>
been created and the SQL completion plugin has been initialized.&nbsp;&nbsp;All SQL<br>
syntax items have been cached in preparation.&nbsp;&nbsp;The SQL filetype script detects<br>
we are attempting to use two different completion plugins.&nbsp;&nbsp;Since the SQL maps<br>
begin with&nbsp;<span class="Special">&lt;C-C&gt;</span>, the maps will toggle the&nbsp;<a class="Identifier" href="options.html#'omnifunc'">'omnifunc'</a>&nbsp;when in use.&nbsp;&nbsp;So you<br>
can use&nbsp;<span class="Special">&lt;C-X&gt;&lt;C-O&gt;</span>&nbsp;to continue using the completion for Perl (using the syntax<br>
completion plugin) and&nbsp;<span class="Special">&lt;C-C&gt;</span>&nbsp;to use the SQL completion features.<br>
<br>
Step 3<br>
<span class="PreProc">------</span><br>
Setting the filetype back to Perl sets all the usual &quot;perl&quot; related items back<br>
as they were.<br>
<br>
<br>
vim&#0058;tw=78:ts=8:ft=help:norl:<br>
</div>

</article>

<footer>
<a href="#top">Return to the top</a> - <a href="index.html">Return to main</a>
<span class="EnglishJapaneseLink">
  <span class="CurrentLanguage">English</span>
</span>
<br />
<div style="text-align:right;">
Hosted by <a href="https://github.com/vim-jp/vimdoc-en">vimdoc-en project</a><br />
If you met any problem, please report it to <a href="https://github.com/vim-jp/vimdoc-en/issues">issue</a>.<br />
</div>
</footer>

<!--<script src="js/check-referrer.js" type="text/javascript"></script>-->

</body>
</html>
<!-- vim:set ts=8 sts=2 sw=2 tw=0 et: -->
